×
☰ See All Chapters

Docker CMD vs ENTRYPOINT command

CMD

ENTRYPOINT

Parameters set from CMD command can be overridden by docker run command.

Parameters set from ENTRYPOINT command cannot be overridden by docker run command.

When docker run command defines parameters then CMD parameters are ignored

When docker run command defines parameters then docker run command parameters are appended to ENTRYPOINT parameters.

CMD command can be used to set default parameters. CMD command parameters will be used when there is no parameters set from docker run command.

ENTRYPOINT command cannot used to set default parameters. ENTRYPOINT command parameters will be always used.

Instructions set from ENTRYPOINT command cannot be overridden by providing instructions to docker run command. If any parameters are provided in docker run command, all those are appended to ENTRYPOINT command parameters.

docker-cmd-vs-entrypoint-command-0
 

Instructions set from CMD command can be overridden by providing instructions to docker run command. If any parameters are provided in docker run command, all the CMD command parameters will be ignored.

docker-cmd-vs-entrypoint-command-1
 

All Chapters
Author